# Maintainer: David Runge <dvzrv@archlinux.org>

pkgname=gmsynth.lv2
pkgver=0.6.0
pkgrel=1
pkgdesc="General MIDI LV2 Synth"
arch=(loong64 x86_64)
url="https://x42-plugins.com/x42/x42-gmsynth"
license=(GPL-2.0-or-later)
groups=(
  pro-audio
  lv2-plugins
)
depends=(glibc)
makedepends=(
  fluidsynth
  lv2
)
checkdepends=(lv2lint)
source=(
  $pkgname-$pkgver.tar.gz::https://github.com/x42/$pkgname/archive/v$pkgver.tar.gz
  $pkgname-0.5.1-use_system_fluidsynth.patch
)
sha512sums=('841744fa02266d02ccfb1c911248ac3ffafeb3582d92989f79d58af549adc84b7b3775e8ce0d004bfe36add49a5050dbb17fc163a97ff5b0d152e7c8a75afbe3'
            'a0f2a09a6a839c38dc3234a719a633eb221f2afca2a97bbecf17b7d0c8dc71befec3768b882deb20357d55186e81e342cad73eb5e08426a1e2108949d11b3cf2')
b2sums=('751c9c853a6f77e423fe5a195c90fef24fa0f735c7dd51d361fc6388805be08199ba779eef4616f975faf20a4c0f63fd914c8d922c3e59cac8d0dea8b243aad8'
        'cb327b55536006a862540e769497d138a6815bbee83f9365f97778adf8c542f3ce49e83d07dd532e66c39ce57a4c1eedc79c982b8ac350f22311f9443f682954')

prepare() {
  # use system fluidsynth
  patch -Np1 -d $pkgname-$pkgver -i ../$pkgname-0.5.1-use_system_fluidsynth.patch
}

build() {
  make -C $pkgname-$pkgver
}

check() {
  lv2lint -Mpack -I $pkgname-$pkgver/build "http://gareus.org/oss/lv2/gmsynth"
}

package() {
  depends+=(
    fluidsynth libfluidsynth.so
  )

  make DESTDIR="$pkgdir/" PREFIX=/usr install -C $pkgname-$pkgver
  install -vDm 644 $pkgname-$pkgver/README.md -t "$pkgdir/usr/share/doc/$pkgname/"
}
